package zd.vrp.global;

public class City{
	//static information
	private int id;
	private double x;
	private double y;
	private double etime;
	private double ltime;
	private double demand;
	private double serviceTime;
	
	
	//dynamic information
	private double arrivalTime;
	private double waitingTime;
	private double startTime;
	private double finishTime;
	
	//information related to route
	private Route route;
	private int routePosition;
	
	public City(){
		route = null;
	}
	
	public City(int id){
		this();
		this.id = id;
	}

	public Route getRoute() {
		return route;
	}

	public void setRoute(Route route) {
		this.route = route;
	}

	public int getRoutePosition() {
		return routePosition;
	}

	public void setRoutePosition(int routePosition) {
		this.routePosition = routePosition;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public double getX() {
		return x;
	}

	public void setX(double x) {
		this.x = x;
	}

	public double getY() {
		return y;
	}

	public void setY(double y) {
		this.y = y;
	}

	public double getEtime() {
		return etime;
	}

	public void setEtime(double etime) {
		this.etime = etime;
	}

	public double getLtime() {
		return ltime;
	}

	public void setLtime(double ltime) {
		this.ltime = ltime;
	}

	public double getDemand() {
		return demand;
	}

	public void setDemand(double demand) {
		this.demand = demand;
	}

	public double getServiceTime() {
		return serviceTime;
	}

	public void setServiceTime(double serviceTime) {
		this.serviceTime = serviceTime;
	}

	public double getArrivalTime() {
		return arrivalTime;
	}

	public void setArrivalTime(double arrivalTime) {
		this.arrivalTime = arrivalTime;
		this.waitingTime = Math.max(this.etime-arrivalTime, 0);
		this.startTime = Math.max(this.etime, arrivalTime);
		this.finishTime = this.startTime + this.serviceTime;
		
	}

	public double getWaitingTime() {
		return waitingTime;
	}

	public void setWaitingTime(double waitingTime) {
		this.waitingTime = waitingTime;
	}

	public double getStartTime() {
		return startTime;
	}

	public void setStartTime(double startTime) {
		this.startTime = startTime;
	}

	public double getFinishTime() {
		return finishTime;
	}

	public void setFinishTime(double finishTime) {
		this.finishTime = finishTime;
	}

	public City clone(){
		// TODO Auto-generated method stub
		City c = new City();
		c.setDemand(this.getDemand());
		c.setEtime(this.getEtime());
		c.setId(this.getId());
		c.setRoute(this.getRoute());
		c.setRoutePosition(this.getRoutePosition());
		c.setServiceTime(this.getServiceTime());
		c.setX(this.getX());
		c.setY(this.getY());
		c.setLtime(this.getLtime());
		c.setArrivalTime(this.getArrivalTime());
		
		return c;
	}
	
}
